import request from '@/utils/request'

// 查询补考安排列表
export function listRetakeSchedule(query) {
  return request({
    url: '/jiaxiao/retake/list',
    method: 'get',
    params: query
  })
}

// 查询补考安排详细
export function getRetakeSchedule(retakeId) {
  return request({
    url: '/jiaxiao/retake/' + retakeId,
    method: 'get'
  })
}

// 新增补考安排
export function addRetakeSchedule(data) {
  return request({
    url: '/jiaxiao/retake',
    method: 'post',
    data: data
  })
}

// 修改补考安排
export function updateRetakeSchedule(data) {
  return request({
    url: '/jiaxiao/retake',
    method: 'put',
    data: data
  })
}

// 删除补考安排
export function delRetakeSchedule(retakeId) {
  return request({
    url: '/jiaxiao/retake/' + retakeId,
    method: 'delete'
  })
}

// 查询学员的待考试补考安排
export function getPendingRetakeByStudentAndSubject(studentId, subjectId) {
  return request({
    url: '/jiaxiao/retake/student/' + studentId + '/subject/' + subjectId,
    method: 'get'
  })
}

// 查询学员所有待考试的补考安排
export function getPendingRetakesByStudent(studentId) {
  return request({
    url: '/jiaxiao/retake/student/' + studentId,
    method: 'get'
  })
}

// 查询指定日期范围内的补考安排
export function getRetakeScheduleByDateRange(startDate, endDate) {
  return request({
    url: '/jiaxiao/retake/calendar',
    method: 'get',
    params: {
      startDate: startDate,
      endDate: endDate
    }
  })
}

// 完成补考安排
export function completeRetakeSchedule(retakeId) {
  return request({
    url: '/jiaxiao/retake/complete/' + retakeId,
    method: 'put'
  })
}

// 取消补考安排
export function cancelRetakeSchedule(retakeId) {
  return request({
    url: '/jiaxiao/retake/cancel/' + retakeId,
    method: 'put'
  })
}
